#include <bits/stdc++.h>

#define ll long long
#define int long long
#define pii pair<int, int>
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define dep(i, x, y) for(int i = x; i >= y; --i)
#define debug(x) cout << #x": " << x << endl;
#define ct printf("\n");
#define mod 1000000007
using namespace std;
const int maxn = 1e6+10;
const ll inf = 1e18;

template <typename _tp>
inline void read(_tp& x) {
    char ch = getchar(), sgn = 0;
    while (ch ^ '-' && !isdigit(ch)) ch = getchar();
    if (ch == '-') ch = getchar(), sgn = 1;
    for (x = 0; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
    if (sgn) x = -x;
}

signed main(){
    vector<pii>range; // 
    while(1){
        char s[10];
        int l, r;
        scanf(" %s", &s);
        vector<pii>_range;
        if(s[0] == 'a'){
            scanf("%lld %lld", &l, &r);
            if(l == r) continue;
            r--;
            int _l = l, _r = r;
            int flag = 0;
            if(!range.size()) _range.push_back(make_pair(_l, _r)), flag = 1;
            for(auto v: range){
                if(v.first > r + 1) _range.push_back(make_pair(_l, _r)), flag = 1;
                if((v.first >= l && v.first <= r + 1) || (v.second >= l - 1 && v.second <= r) || (v.first <= l && v.second >= r) || (v.first >= l && v.second <= r)){
                    _l = min(_l, v.first);
                    _r = max(_r, v.second);
                }
                else _range.push_back(v);
            }   
            if(!flag) _range.push_back(make_pair(_l, _r));
            range = _range;
        }
        else if(s[0] == 'r'){
            scanf("%lld %lld", &l, &r);
            if(l == r) continue;
            r--;
            for(auto v: range){
                if(v.first >= l && v.second <= r) continue;
                else if(v.first >= l && v.first <= r){
                    _range.push_back(make_pair(r + 1, v.second));
                }
                else if(v.second >= l && v.second <= r){
                    _range.push_back(make_pair(v.first, l - 1));
                }
                else if(v.first <= l && v.second >= r){
                    _range.push_back(make_pair(v.first, l - 1));
                    _range.push_back(make_pair(r + 1, v.second));
                }
                else _range.push_back(v);
            }   
            range = _range;
        }
        else {
            for(auto v: range){
                printf("[%lld, %lld) ", v.first, v.second + 1);
            }
            printf("\n");
        }
    }
    return 0;
}